{* Smarty *}
{extends file="include/base_with_menu.tpl"}

{block name="javascript"}
<script type="text/javascript">
var token_key = '{$token_name|escape}',
	token_hash = '{$token_hash|escape}';
{literal}
$(function() {
	var triggers = [
		{src:$('[name=grade1_class_num],[name=grade2_class_num],[name=grade3_class_num]'),dist:$('#class_total')},
		{src:$('[name=grade1_people_num],[name=grade2_people_num],[name=grade3_people_num]'),dist:$('#people_total')}
	];
	$(triggers).each(function(){
		var self = this;
		self.src
		.bind('keyup', function(){
			var num = 0;
			self.src.each(function(){num += this.value|0});
			self.dist.text(num);
	    })
	    .trigger('keyup');
	})
});
function delete_school()
{
	if(confirm('是否要删除该学校？')) {
		var post_vars = {'school_id': $('[name=school_id]').val()};
		post_vars[token_key] = token_hash;
		$.post('/market/se/school/delete', post_vars, function(){
			window.location = $('[name=return_url]').val();
		});
	}
}
{/literal}
</script>
{/block}

{block name="content"}
<h3 class="blockTitle">编辑学校</h3>
<div class="layout">
    <form method="post" action="/market/se/school/edit">
    <table width="100%" class="tbLayout01" cellspacing="0" cellpadding="0">
    
    	<tr>
    		<td colspan="2">学校名称</td>
    		<td class="textLeft"><input type="text" class="txt01" name="name" size="30" maxlength="30" value="{$school.name|escape}" /></td>
    	</tr>
    	
    	<tr>
    		<td width="50" rowspan="4">班级数</td>
    		<td width="50">高一</td>
    		<td class="textLeft"><input type="text" class="txt01" name="grade1_class_num" maxlength="5" size="5" value="{$school.grade1_class_num|escape}" /></td>
    	</tr>
    	<tr>
    		<td>高二</td>
    		<td class="textLeft"><input type="text" class="txt01" name="grade2_class_num" maxlength="5" size="5" value="{$school.grade2_class_num|escape}" /></td>
    	</tr>
    	<tr>
    		<td>高三</td>
    		<td class="textLeft"><input type="text" class="txt01" name="grade3_class_num" maxlength="5" size="5" value="{$school.grade3_class_num|escape}" /></td>
    	</tr>
    	<tr>
    		<td>总计</td>
    		<td class="textLeft" id="class_total"></td>
    	</tr>
    	
    	<tr>
    		<td rowspan="4">人数</td>
    		<td>高一</td>
    		<td class="textLeft"><input type="text" class="txt01" name="grade1_people_num" maxlength="5" size="5" value="{$school.grade1_people_num|escape}" /></td>
    	</tr>
    	<tr>
    		<td>高二</td>
    		<td class="textLeft"><input type="text" class="txt01" name="grade2_people_num" maxlength="5" size="5" value="{$school.grade2_people_num|escape}" /></td>
    	</tr>
    	<tr>
    		<td>高三</td>
    		<td class="textLeft"><input type="text" class="txt01" name="grade3_people_num" maxlength="5" size="5" value="{$school.grade3_people_num|escape}" /></td>
    	</tr>
    	<tr>
    		<td>总计</td>
    		<td class="textLeft" id="people_total"></td>
    	</tr>
    	
    	<tr>
    		<td colspan="2">地址</td>
    		<td class="textLeft"><input type="text" class="txt01" name="location" maxlength="45" size="45" value="{$school.location|escape}" /></td>
    	</tr>
    	<tr>
    		<td colspan="2">网址</td>
    		<td class="textLeft"><input type="text" class="txt01" name="web" maxlength="100" size="100" value="{$school.web|escape}" /></td>
    	</tr>
    	<tr>
    		<td colspan="2">教务处电话</td>
    		<td class="textLeft"><input type="text" class="txt01" name="tel_jwc" maxlength="45" size="45" value="{$school.tel_jwc|escape}" /></td>
    	</tr>
    	<tr>
    		<td colspan="2">招生老师电话</td>
    		<td class="textLeft"><input type="text" class="txt01" name="tel_zs" maxlength="45" size="45" value="{$school.tel_zs|escape}" /></td>
    	</tr>
    	<tr>
    		<td colspan="2">招聘老师电话</td>
    		<td class="textLeft"><input type="text" class="txt01" name="tel_zp" maxlength="45" size="45" value="{$school.tel_zp|escape}" /></td>
    	</tr>
    	<tr>
    		<td colspan="2">午休时间段</td>
    		<td class="textLeft"><input type="text" class="txt01" name="mid_rest_time" maxlength="45" size="45" value="{$school.mid_rest_time|escape}" /></td>
    	</tr>
    	<tr>
    		<td colspan="2">晚休时间段</td>
    		<td class="textLeft"><input type="text" class="txt01" name="at_rest_time" maxlength="45" size="45" value="{$school.at_rest_time|escape}" /></td>
    	</tr>
    	<tr>
    		<td colspan="2">午休是否锁门</td>
    		<td class="textLeft"><input type="text" class="txt01" name="mid_rest_lock" maxlength="45" size="45" value="{$school.mid_rest_lock|escape}" /></td>
    	</tr>
    	<tr>
    		<td colspan="2">校内教师信息</td>
    		<td class="textLeft"><input type="text" class="txt01" name="teacher_info" maxlength="45" size="45" value="{$school.teacher_info|escape}" /></td>
    	</tr>
    	<tr>
    		<td colspan="2">上次推广时间</td>
    		<td class="textLeft">
    		{if $last_extend}
    			{$last_extend|date_format:'%Y-%m-%d'}
    		{else}
    			暂无
    		{/if}
    		</td>
    	</tr>
    	
        <tr>
            <td colspan="3">
            	<input type="hidden" name="school_id" value="{$school_id}">
                <input type="submit" value="提 交" />&nbsp;&nbsp;
                <input type="button" value="取 消" onclick="window.history.back();" />
                <input type="button" value="删除该学校" onclick="delete_school()" />
            </td>
        </tr>
    </table>
    <input type="hidden" name="{$token_name|escape}" value="{$token_hash}" />
    <input type="hidden" name="return_url" value="{$return_url|default:''}" />
    </form>

    <p>&nbsp;</p>
    <p class="cGreen">提示：</p>
    <ul class="textLeft tip">
        <li>点击取消返回学校列表页面，不会修改学校</li>
    </ul>
</div>
{/block}
